import { request } from '@/utils'

export function info(id) {
  return request({
    url: `/sys/dict/${id}`,
    method: 'get',
  })
}

export function list(params) {
  return request({
    url: `/sys/dict`,
    method: 'get',
    params,
  })
}

export function childList(parentId) {
  return request({
    url: `/sys/dict/child`,
    method: 'get',
    params: { parentId },
  })
}

export function add(data) {
  return request({
    url: `/sys/dict`,
    method: 'post',
    data,
  })
}

export function edit(data) {
  return request({
    url: `/sys/dict`,
    method: 'put',
    data,
  })
}

export function del(id) {
  return request({
    url: `/sys/dict/${id}`,
    method: 'delete',
  })
}

export function queryDict(code) {
  return request({
    url: `/sys/dict/select`,
    method: 'get',
    params: { code },
  })
}

export function queryDicts(codes) {
  return request({
    url: `/sys/dict/select/arr`,
    method: 'get',
    params: { codes },
  })
}
